package base.day22.stream;

import java.util.ArrayList;
import java.util.List;

public class Mystream1 {
    public static void main(String[] args) {
        ArrayList<String> list=new ArrayList<>(List.of("张三","张一","张二2","李四","王五"));
        ArrayList<String> newlist=new ArrayList<>();
        for (String s : list) {
            if (s.startsWith("张")){
                newlist.add(s);
            }
        }
        System.out.println(newlist);

        list.stream().filter(s->s.startsWith("张"))
                .filter(s->s.length()==3)
                .forEach(s-> System.out.println(s));

    }
}
